package com.gitee.pagekit;


import java.io.Serializable;
import java.util.List;

/**
 * @author wxy
 * @version 1.0
 * @date 2024/5/11 17:22
 */
public class Page<T> implements Serializable {

    private Integer pageNum;

    private Integer pageSize;

    private Long count;

    private List<T> list;

    private Page(Integer pageNum, Integer pageSize) {
        if(pageNum != null && pageNum >= 1){
            this.pageNum = pageNum;
        }
        if(pageSize != null && pageSize >= 1){
            this.pageSize = pageSize;
        }
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public Page setParams(Integer pageNum, Integer pageSize) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        return this;
    }

    private Page(List<T> list){
        this.list = list;
    }

    public Page(){}

    //分页结束时调用
    public void endPage(){}

    //分页开始时调用
    public void startPage(){}



    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }
}
